import React, { Component } from 'react';

export default class List extends Component {
    constructor(props) {
        super(props)
        this.state = {
            msg:'zyx',
            name:'来自子类的消息',
            age:58
        }
    }
   change=()=> {
       this.props.callBack(this.state.msg,this.state.name,this.state.age)
   }

  

    render() {
        return (
            <div className="listWrapper">
               <p style={pcolor}> {this.props.name}</p>
               <p style={pcolor}> {this.props.age}</p>
               <button style={{fontSize:16,color:'blue',borderRadius:10,border:'none'}} onClick={this.change}>父子传值</button>
            </div>
            )
    }
}

const pcolor = {
    color:'red',
    display: 'inline-block',
    marginRight: '16px'
}
